/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.imageio.jpeg;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Set;

import sk.jp.imageio.jpeg.metadata.Info;
import sk.jp.imageio.jpeg.metadata.Rating;
import sk.jp.imageio.jpeg.metadata.Tag;

/**
 * JPEG Image.
 */
public interface JpegImage {

    /**
     * Returns a set of image tags.
     * @return set of image tags.
     */
    Set<Tag> getTags();

    /**
     * Returns image rating.
     * @return image rating.
     */
    Rating getRating();

    /**
     * Returns additional image information.
     * @return additional image information.
     */
    Info getInfo();

    /**
     * Returns original renderable image.
     * @return renderable image.
     */
    BufferedImage getBufferedImage();

    /**
     * Returns resized renderable image.
     * <p>This method can do the same as {@link #getThumbnail(Dimension)}, but
     * implementations can support (recommended) caching of thumbnail images,
     * created by {@link #getThumbnail(Dimension)} method.
     * @param dimension required dimension.
     * @return renderable image resized to specified dimension.
     */
    BufferedImage getBufferedImage(Dimension dimension);

    /**
     * Returns renderable image thumbnail.
     * @param dimension required thumbnail dimension.
     * @return renderable image thumbnail.
     */
    BufferedImage getThumbnail(Dimension dimension);

    /**
     * Rotate image about 90 degrees to left.
     */
    void rotateLeft();

    /**
     * Rotate image about 90 degrees to right.
     */
    void rotateRight();

    /**
     * Frees picture data of image.
     * <p>Optional operation.
     */
    void free();

}
